package com.example.bazinga.babyhealth.modle;

import android.util.Log;

import com.github.mikephil.charting.data.BarEntry;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;

/**
 * Created by bazinga on 2017/5/4.
 */

public class OutDataModel implements IOutDataModel{

    @Override
    public void loadExcelProgress(GetExcelDataLoadListener getExcelDataLoadListener) {
        ArrayList<ArrayList<String>> datas = new ArrayList<>();

        int a = 1;

        for (int i=0 ;i<24;i++){

            if ( a == 1 )

                a = -1;
            else

                a = 1;

            Random random = new Random();

            final float temp = 35+random.nextFloat()-a;

            String d = new Date(System.currentTimeMillis()).toString();

            Log.e("MainActivity", "getBillData: " + d);

            ArrayList<String> data = new ArrayList<>();

            data.add(d);

            data.add(temp+"");

            if (temp > 37f)

                data.add("体温不正常");

            else

                data.add("体温正常");

            datas.add(data);

        }

        getExcelDataLoadListener.onCompleted(datas);
    }

    @Override
    public void loadTemoDataProgress(GetTemDataLoadListener getTemDataLoadListener) {
        List<BarEntry> entries = new ArrayList<>();
        entries.add(new BarEntry(0f,35.2f));
        entries.add(new BarEntry(1f,35.1f));
        entries.add(new BarEntry(2f,36.2f));
        entries.add(new BarEntry(3f,35.2f));
        entries.add(new BarEntry(4f,35.2f));
        entries.add(new BarEntry(5f,35.2f));
        entries.add(new BarEntry(6f,35.2f));
        entries.add(new BarEntry(7f,35.2f));
        entries.add(new BarEntry(8f,35.2f));
        entries.add(new BarEntry(9f,35.2f));
        entries.add(new BarEntry(10f,36.4f));
        entries.add(new BarEntry(11f,35.4f));
        entries.add(new BarEntry(12f,37.4f));
        entries.add(new BarEntry(13f,33.4f));
        entries.add(new BarEntry(14f,34.4f));
        entries.add(new BarEntry(15f,35.4f));
        entries.add(new BarEntry(16f,36.9f));
        entries.add(new BarEntry(17f,34.4f));
        entries.add(new BarEntry(18f,37.5f));
        entries.add(new BarEntry(19f,34.9f));
        entries.add(new BarEntry(20f,35.1f));
        entries.add(new BarEntry(21f,36.1f));
        entries.add(new BarEntry(22f,36.7f));
        entries.add(new BarEntry(23f,36.9f));
        entries.add(new BarEntry(24f,36.2f));
        getTemDataLoadListener.onCompleted(entries);
    }
}
